<template>
  <div class="rnpage">
    <div class="rnpage-top">
      <div class="back">
        <svg class="icon" aria-hidden="true" @click="$router.push('/')">
          <use xlink:href="#icon-zuojiantou" />
        </svg>
        <div class="top-name">排行榜</div>
      </div>
      <div class="navigation">
        <ul>
          <li class="default">官方</li>
          <li>精选</li>
          <li>曲风</li>
          <li>全球</li>
          <li>MV</li>
          <li>特色</li>
        </ul>
      </div>
    </div>

    <div class="official">
      <h3>官方榜</h3>
      <div class="soar" v-for="item in toplistDetail" :key="item.id">
        <div class="soar-top">{{item.updateFrequency}}</div>
        <div class="soar-content">
          <div class="left">
            <span>{{item.name}}</span>
            <img :src="item.coverImgUrl" alt />
          </div>
          <div class="right">
            <div class="list" v-for="(sing,i) in item.tracks" :key="i">
              <span class="song">{{sing.first}}</span>
              <span class="singer">- {{sing.second}}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getToplistDetail } from "@/api/index.js";

export default {
  data() {
    return {
      toplistDetail: []
    };
  },
  async mounted() {
    let res = await getToplistDetail();
    this.toplistDetail = res.data.list;
    this.toplistDetail = this.toplistDetail.splice(0, 4);

    console.log(this.toplistDetail);
  }
};
</script>
<style scoped lang="less">
.rnpage {
  .back {
    display: flex;
    padding: 0.1rem;
    align-items: center;
    .icon {
      width: 0.4rem;
      height: 0.4rem;
      margin-right: 0.2rem;
    }
  }
  .navigation {
    width: 7.5rem;
    ul {
      display: flex;
      justify-content: space-around;
      flex-wrap: nowrap;
      list-style: none;
      .default {
        border-bottom: 3px solid red;
      }
    }
  }
  .official {
    margin-bottom: 1.2rem;
    h3 {
      font-size: 0.34rem;
      margin: 0.2rem;
    }
    .soar {
      width: 7.1rem;
      height: 2.5rem;
      background-color: pink;
      margin: 0.3rem auto;
      border-radius: 0.2rem;
      position: relative;
      .soar-top {
        position: absolute;
        top: 0.1rem;
        right: 0.2rem;
        font-size: 0.18rem;
        color: #aaa;
      }
      .soar-content {
        display: flex;
        // position: relative;

        .left {
          width: 2rem;
          height: 2.5rem;
          padding: 0.2rem;
          span {
            padding: 0.1rem;
            font-size: 0.4rem;
            font-weight: 900;
            color: red;
          }
          img {
            width: 1.3rem;
            height: 1.3rem;
            border-radius: 0.4rem;
          }
        }
        .right {
          width: 4rem;
          padding-top: 0.2rem;
          .list {
            margin-top: 0.2rem;
            .song {
              font-size: 0.28rem;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
            }
            .singer {
              font-size: 0.28rem;
              color: #aaa;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
            }
          }
        }
      }
    }
  }
}
</style>